package cn.china.receiver;

import cn.china.receiver.serviceimpl.StudentServiceImpl;
import entity.Student;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@RabbitListener(queues="TestDirectQueue")//监听的队列名称 TestDirectQueue
public class DirectReceiver {
   @Autowired
    StudentServiceImpl ssi;

    @RabbitHandler
    public void process(Student student) {
//        int index=ssi.insert(student);
        System.out.println("DirectReceiver消费者收到消息===:" + student);

    }

    @RabbitHandler
    public void process2(Map map) {
        System.out.println("DirectReceiver消费者收到消息  : " + map);

    }


}
